package com.killer.dao;

import com.killer.pojo.Person;
import org.neo4j.driver.types.Relationship;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author ：Killer
 * @date ：Created in 21-2-7 上午11:32
 * @description：${description}
 * @modified By：
 * @version: version
 */
public interface PersonRepository extends Neo4jRepository<Person,Long>{

    @Query("match p=( (p1:Person)-[r*]->(p2:Person) ) where p1.name=$startName and p2.name=$endName return p")
    public List<Person> listPath(@Param("startName") String startName, @Param("endName") String endName);

    @Query("match p=( (p1:Person)-[r*1]->(p2:Person) ) where p1.name=$startName and p2.name=$endName return p")
    public List<Person> checkRelate(@Param("startName") String startName, @Param("endName") String endName);

}
